const webpack = require('webpack');
var path = require('path');
module.exports = {
  mode: "production",
  entry: {
    main: './main.js',
  },
  output: {
    path: path.join(__dirname, "build"),
    publicPath: './',
    filename: '[name].js'
  },
  module: {
    rules: [
      {
        test: /\.(png|jpg|gif)$/i,
        use: [
          {
            loader: 'url-loader',
            options: {
              limit: 8192,
            },
          },
        ],
      },
      {
        test: /\.(m?js)|(jsx)$/,
        exclude: /(node_modules|bower_components)/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['@babel/preset-env', "@babel/preset-react"],
            plugins: [
              '@babel/plugin-transform-runtime'
            ]
          }
        }
      },
    ]
  },
  plugins: [
    new webpack.DllReferencePlugin({
      name: "bundle_library",
      manifest: require("./build/bundle.manifest.json"),
    }),
  ]
};